<?php
class Core_Data_Validationuserpassword {
	
	/**
	 * database handler
	 * 
	 * @var database
	 */
	public $database;
	
	public function __construct(){
		
		$this->database = new Core_Driver_MysqlImproved();
		
	}
	
	/**
	 * get username and password
	 * 
	 * @param string $username
	 * @param string $password
	 * @return array $userData
	 */
	public function validationData($username, $password){
		
		$this->database->connect();
		
		$username = $this->database->escape($username);
		$password = $this->database->escape($password);
		
		$this->database->prepare(
			"
				SELECT
				users_data.user_username,
				users_data.username_password
				FROM 
				users_data
				WHERE
				users_data.user_username = '$username'
				AND
				users_data.user_password = SHA1('$password')
				LIMIT
				1
				;
				"
		);
		
		$this->database->query();
		
		$userData = $this->database->fetch('array');
		
		return $userData;
		
	}
	
}